﻿#pragma once

class CConvISO8859_1
{
public:
	CConvISO8859_1(void);
	~CConvISO8859_1(void);
	bool static convOne(LPCTSTR lp, bool bStrict, TCHAR &tc, int &len);
	bool static convOne(LPCSTR lp, bool bStrict, TCHAR &tc, int &len);
	int static inline tcschncmp(const TCHAR *pTcs, const char *pCh, register size_t Count)
	{
		TCHAR c1, c2;
		int v;

		if (Count == 0)	return 0;

		do {
			c1 = *pTcs++;
			c2 = static_cast<TCHAR>(*pCh++);
			v = static_cast<int>(c1) - static_cast<int>(c2);
		} while ((v == 0) && (c1) && (--Count > 0));

		return v;
	}

	int static inline tcschnicmp(const TCHAR *pTcs, const char *pCh, register size_t Count)
	{
		TCHAR c1, c2;
		int v;

		if (Count == 0)	return 0;

		do {
			c1 = *pTcs++;
			c2 = static_cast<TCHAR>(*pCh++);
			v = static_cast<int>(_totlower(c1)) - static_cast<int>(_totlower(c2));
		} while ((v == 0) && (c1) && (--Count > 0));

		return v;
	}
};

